package com.navid.trafalgar.model;

import com.jme3.asset.AssetManager;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;

/**
 *
 * @author alberto
 */
abstract class TrafalgarNode extends Node {
    
    private boolean debug = false;
    private DirectionNode directionNode;
    
    public TrafalgarNode(Vector3f lookAt, AssetManager assetManager) {
        directionNode = new DirectionNode(lookAt, assetManager);
        this.attachChild(directionNode);
        onDebugDisabled();
    }
    
    public void setDirection(Vector3f newDirection) {
        directionNode.setDirection(newDirection);
    }
    
    public Vector3f getGlobalDirection() {
        return directionNode.getGlobalDirection();
    }
    
    public final void setDebug(boolean value) {
        if (debug && !value) {
            onDebugEnabled();
        } else if (!debug && value) {
            onDebugDisabled();
        }
        this.debug = value;
    }
    
    protected void onDebugEnabled() {
        directionNode.setCullHint(CullHint.Never);
    }
    
    protected void onDebugDisabled() {
        directionNode.setCullHint(CullHint.Always);
    }
}
